#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mongodb_net8 AS base
WORKDIR /app
EXPOSE 8080

ENV APP_UID=0 ASPNETCORE_HTTP_PORTS=32770 DOTNET_RUNNING_IN_CONTAINER=true
# HTTP 端口
EXPOSE 32770
# MongoDB 数据库
EXPOSE 27017

FROM mongodb_net8 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["DetectWebApi.csproj", "."]
RUN dotnet restore "./././DetectWebApi.csproj"	
COPY . .
WORKDIR "/src/."

RUN dotnet build "./DetectWebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./DetectWebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false


FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DetectWebApi.dll" ]